package kr.hkit.androidcomplete01.ch11;

import kr.hkit.androidcomplete01.R;
import android.app.Activity;
import android.os.Bundle;
import android.text.Editable;
import android.view.View;
import android.widget.EditText;

public class EditableTestEx extends Activity {

	EditText mEdit;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.ch11_editabletestex);
		
		mEdit = (EditText) findViewById(R.id.edit);
		
	}
	
	public void mOnClick(View v) {
		Editable edit = mEdit.getText();
		switch (v.getId()) {
		case R.id.insert:
			edit.insert(0, "INS");
			break;
		case R.id.delete:
			edit.delete(2, 5);
			break;
		case R.id.append:
			edit.append("APP");
			break;
		case R.id.replace:
			edit.replace(2, 5, "REP");
			break;
		case R.id.clear:
			edit.clear();
			break;
		}
		
	}
}
